Skip to content

test: migrate stats/base/dists/rayleigh/logcdf to ULP-based assertions - #14322

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-rayleigh-logcdf
Aug 16, 2026
Merged

test: migrate stats/base/dists/rayleigh/logcdf to ULP-based assertions#14322
kgryte merged 1 commit into
developfrom
kgryte/ulp-rayleigh-logcdf

Conversation

@kgryte

@kgryte kgryte commented Aug 16, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

Changes are limited to test files:

  • test/test.logcdf.js
  • test/test.factory.js
  • test/test.native.js

In each fixture loop, the if ( y === expected[i] ) { ... } else { delta/tol ... } branch was replaced with

t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );

and the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires (along with the delta and tol locals) were removed.

Final ULP constant: 0 (all fixture loops, in both the JavaScript and native test files).

The bound was tightened agentically: starting from a high value and lowering it to the minimum integer that still passes. The measured minimum is 0 for every fixture file — the JavaScript implementation, the factory-generated function, and the native implementation each reproduce the Julia reference values bit-exactly across all 3000 fixture values (1000 each in small_scale.json, medium_scale.json, and large_scale.json).

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

The measured minimum is 0 ULP, which is what is committed here. If reviewers would prefer a small amount of headroom (e.g., 1) to guard against platform-specific differences on architectures not exercised locally, that is an easy change.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Verification performed locally on linux/x64, Node.js v22:

  • test/test.js — 3 passing
  • test/test.logcdf.js — 3011 passing
  • test/test.factory.js — 3013 passing
  • test/test.native.js — 3011 passing (the native add-on was compiled locally via node-gyp rebuild, so these assertions actually executed rather than being skipped)

The full suite was run twice at the final ULP value with identical results, confirming no FMA/arch-dependent flakiness locally. make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/rayleigh/logcdf/.*" passes cleanly, and the only files changed are the three test files.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code, which mirrored the conversion idiom from already-migrated packages (e.g., stats/base/dists/rayleigh/pdf and stats/base/dists/arcsine/logcdf) and empirically determined the minimum ULP bound over the full fixture set.


@stdlib-js/reviewers


Generated by Claude Code

Replaces relative tolerance comparisons with `isAlmostSameValue` checks
in the test fixture loops. The JavaScript and native implementations
both reproduce the Julia reference values exactly over all three fixture
files, so the ULP bound was tightened to `0`.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1SM9ZH1ZA2Gamaz998sP9
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 16, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

No coverage information available.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 16, 2026
@kgryte
kgryte marked this pull request as ready for review August 16, 2026 06:25
@kgryte
kgryte requested a review from a team August 16, 2026 06:25
@kgryte
kgryte merged commit e6e98e6 into develop Aug 16, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-rayleigh-logcdf branch August 16, 2026 06:26
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants